package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmMaterialDto;
import com.heima.wemedia.service.WmMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @ClassName WeMaterialController
 * @Description TODO
 * @Author kiku
 * @Date 2024/8/20 21:04
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/v1/material")
public class WeMaterialController {
    @Autowired
    private WmMaterialService wmMaterialService;

    @PostMapping("/upload_picture")
    public ResponseResult uploadPicture(MultipartFile multipartFile) throws IOException {
        ResponseResult responseResult = wmMaterialService.uploadPicture(multipartFile);
        return responseResult;
    }

    @PostMapping("/list")
    public ResponseResult findList(@RequestBody WmMaterialDto dto) {

        return wmMaterialService.findList(dto);
    }
}
